package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "return_goods_details", schema = "jinsanjiao", catalog = "")
public class ReturnGoodsDetails {
    private int returnDetailsId;
    private Long returnDetailsQuantity;
    private ReturnGoods returnGoodsByReturnGoodsId;
    private Inventory inventoryByInventoryNumber;

    @Id
    @Column(name = "return_details_id", nullable = false)
    public int getReturnDetailsId() {
        return returnDetailsId;
    }

    public void setReturnDetailsId(int returnDetailsId) {
        this.returnDetailsId = returnDetailsId;
    }

    @Basic
    @Column(name = "return_details_quantity", nullable = true, precision = 0)
    public Long getReturnDetailsQuantity() {
        return returnDetailsQuantity;
    }

    public void setReturnDetailsQuantity(Long returnDetailsQuantity) {
        this.returnDetailsQuantity = returnDetailsQuantity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ReturnGoodsDetails that = (ReturnGoodsDetails) o;
        return returnDetailsId == that.returnDetailsId &&
                Objects.equals(returnDetailsQuantity, that.returnDetailsQuantity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(returnDetailsId, returnDetailsQuantity);
    }

    @ManyToOne
    @JoinColumn(name = "return_goods_id", referencedColumnName = "return_goods_id")
    public ReturnGoods getReturnGoodsByReturnGoodsId() {
        return returnGoodsByReturnGoodsId;
    }

    public void setReturnGoodsByReturnGoodsId(ReturnGoods returnGoodsByReturnGoodsId) {
        this.returnGoodsByReturnGoodsId = returnGoodsByReturnGoodsId;
    }

    @ManyToOne
    @JoinColumn(name = "inventory_number", referencedColumnName = "inventory_number")
    public Inventory getInventoryByInventoryNumber() {
        return inventoryByInventoryNumber;
    }

    public void setInventoryByInventoryNumber(Inventory inventoryByInventoryNumber) {
        this.inventoryByInventoryNumber = inventoryByInventoryNumber;
    }
}
